/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.jfonia.connect5.basics;

/**
 * Auxiliary observer class. This class can be implemented inline and can then
 * be added to any node. It's possible to implement the onNotify() body as desired.
 *
 * @author Rik Bauwens
 */
public abstract class AbstractObserver implements Observer
{
        private Node node;

        public AbstractObserver(Node node)
        {
                this.node = node;
                switchOn();
        }

        public void switchOff()
        {
                node.removeObserver(this);
        }

        public void switchOn()
        {
                node.addObserver(this);
        }        
}
